package com.tjsinfo.tjsoa.reminded.action;

import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

import com.tjsinfo.tjsoa.reminded.vo.TSystemReminded;
import com.tjsinfo.tjsoa.reminded.bo.TSystemRemindedManager;
import com.tjsinfo.tjsoa.reminded.dao.TSystemRemindedDao;
import com.tjsinfo.tjsoa.system.vo.User;

public class RemindedDelAction extends Action {
	TSystemRemindedManager systemRemindedManager;
	TSystemRemindedDao systemRemindedDao;
//	TMeetingNotifyManager notifyManager;

	public TSystemRemindedManager getSystemRemindedManager() {
		return systemRemindedManager;
	}

	public void setSystemRemindedManager(
			TSystemRemindedManager systemRemindedManager) {
		this.systemRemindedManager = systemRemindedManager;
	}
	
	public TSystemRemindedDao getSystemRemindedDao() {
		return systemRemindedDao;
	}

	public void setSystemRemindedDao(TSystemRemindedDao systemRemindedDao) {
		this.systemRemindedDao = systemRemindedDao;
	}

	public ActionForward execute(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		try {
			String id=request.getParameter("id");
			TSystemReminded tsr=systemRemindedManager.findById(Integer.valueOf(id));
			systemRemindedDao.delete(tsr);
			
			
			HttpSession session=request.getSession();
			User user=(User)session.getAttribute("user");
			String tag=request.getParameter("tag");
			List<TSystemReminded> list=systemRemindedManager.findByProperty("userId", user.getUser_id());
			request.setAttribute("list", list);

			return mapping.findForward("success");
		} catch (Exception e) {
			e.printStackTrace();

			return mapping.findForward("failed");
		}
	}

}
